<li class="item-lesson clearfix" id="lesson-{{ lesson.id }}"style="word-break: break-all;" >
  <div class="item-line"></div>
  <div class="item-content">
    {% set mediaStatus = lesson.mediaStatus|default(null) %}
 <i><input type="checkbox" value="{{ lesson.id }}" name="lessonid" autocomplete="off"  data-role="batch-select"/></i>  
    {% if lesson.type == 'video' %}
      {% if mediaStatus == 'waiting' %}
      <i class="fa fa-file-video-o text-warning"></i>
      {% elseif mediaStatus == 'doing' %}
      <i class="fa fa-file-video-o text-info"></i>
      {% elseif mediaStatus == 'error' %}
      <i class="fa fa-file-video-o text-danger"></i>
      {% else %}
      <i class="fa fa-file-video-o text-success"></i>
      {% endif %}
    {% elseif lesson.type == 'live' %}
      {% if mediaStatus == 'waiting' %}
      <i class="fa fa-video-camera text-warning"></i>
      {% elseif mediaStatus == 'doing' %}
      <i class="fa fa-video-camera text-info"></i>
      {% elseif mediaStatus == 'error' %}
      <i class="fa fa-video-camera text-danger"></i>
      {% else %}
      <i class="fa fa-video-camera text-success"></i>
      {% endif %}
    {% elseif lesson.type == 'audio' %}
      <i class="fa fa-file-audio-o text-success"></i>
    {% elseif lesson.type == 'testpaper' %}
      <i class="fa fa-file-text-o text-success"></i>
    {% elseif lesson.type == 'text' %}
      <i class="fa fa-file-photo-o text-success"></i>
    {% elseif lesson.type == 'document' %}
      <i class="fa fa-files-o text-success"></i>
    {% elseif lesson.type == 'flash' %}
      <i class="fa fa-film text-success"></i>
    {% else %}
      <i class="fa fa-file-powerpoint-o text-success"></i>
    {% endif %}
    {% if setting('course.custom_chapter_enabled')|default(true) %} 
      
    {% endif %}
    {% if lesson.free == 1 %}<span class="label label-danger">免费</span>{% endif %}

    {% if lesson.type != 'text' and lesson.type != 'live' and lesson.type != 'testpaper' and lesson.mediaId != 0 and not file|default(false) %}    
      <span class="label label-danger fileDeletedLesson" title="课时文件已删除">无效课时</span>
    {% endif %}
    {{ lesson.title }}

    {% if lesson.type in ['video', 'audio'] %}
      <span class="text-muted">{{ lesson.length|duration }}</span>
    {% endif %}

    {% if lesson.type in ['live'] %}
      <span class="text-muted">{{ lesson.startTime|date_format }}</span>
    {% endif %}

    {% if lesson.giveCredit > 0 %}
      <small class="text-muted">({{ lesson.giveCredit }}学分)</small>
    {% endif %}

    {% if lesson.requireCredit > 0 %}
      <small class="text-muted">(需{{ lesson.requireCredit }}学分)</small>
    {% endif %}

    {% if lesson.type != 'testpaper' %}
      {% set mediaTypeName = lesson.type == 'video' ? '视频' : (lesson.type == 'audio' ? '音频' : '文件') %}
      {% if mediaStatus == 'waiting' %}
        <span class="text-warning">(正在等待{{ mediaTypeName }}格式转换)</span>
      {% elseif mediaStatus == 'doing' %}
        <span class="text-info">(正在转换{{ mediaTypeName }}格式)</span>
      {% elseif mediaStatus == 'error' %}
        <span class="text-danger">({{ mediaTypeName }}格式转换失败)</span>
      {% endif %}
    {% endif  %}

    {% if lesson.status == 'unpublished' %}
      <span class="unpublish-warning text-warning">(未发布)</span>
    {% endif %}
  </div>

  <div class="item-actions">
    <a class="btn btn-link" data-toggle="modal" data-target="#modal" data-backdrop="static" data-keyboard="false"
      {% if lesson.type == 'testpaper' %}
        data-url="{{ path('course_manage_lesson_edit_testpaper', {courseId:course.id, lessonId:lesson.id}) }}"
      {% elseif lesson.type == 'live' %}
        data-url="{{ path('live_course_manage_lesson_edit', {courseId:course.id, lessonId:lesson.id}) }}"
      {% else %}
        data-url="{{ path('course_manage_lesson_edit', {courseId:course.id, lessonId:lesson.id}) }}"
      {% endif %}
      ><span class="es-icon es-icon-edit prs"></span>编辑</a>
    {% if lesson.type == 'testpaper' %}
      <a class="btn btn-link" href="{{ path('course_manage_preview_test', {testId:lesson.mediaId}) }}" target="_blank"><span class="es-icon es-icon-visibility prs"></span>预览</a>
    {% else %}
      <a class="btn btn-link" href="{{ path('course_learn', {id:course.id, preview:1}) }}#lesson/{{ lesson.id }}" target="_blank"><span class="es-icon es-icon-visibility prs"></span>预览</a>
    {% endif %}
    <span class="dropdown">
      <a class="dropdown-toggle dropdown-more" id="dropdown-more" data-toggle="dropdown" href="#"><i class="es-icon es-icon-keyboardarrowdown" style="margin-right:3px" aria-haspopup="true" aria-expanded="false"></i>更多</a>

      <ul class="dropdown-menu pull-right dropdown-menu-more" role="menu" style="margin-top:12px;min-width:144px" aria-labelledby="dLabel" style="display:none;">
        
        {% if is_plugin_installed('Homework') and (lesson.type != 'testpaper') %}
          {% set homework =  homeworks[lesson.id]|default(null) %}
          {% set homeworkId =  homework.id|default(null) %}
          {% if homework %}
            <li><a href="{{ path('course_manage_lesson_homework_edit', {courseId:course.id, lessonId:lesson.id, homeworkId:homeworkId }) }}" ><span class="glyphicon glyphicon-list-alt prs"></span>编辑作业</a></li>
            <li><a href="{{ path('course_homework_preview', {courseId:course.id,homeworkId:homeworkId }) }}" class="preview-homework-btn" ><span class="glyphicon glyphicon-eye-open prs"></span>预览作业</a></li>
            <li><a href="javascript:;" class="delete-homework-btn" data-url="{{ path('course_manage_lesson_homework_remove', {courseId:course.id, lessonId:lesson.id, homeworkId:homeworkId }) }}" ><span class="glyphicon glyphicon-trash prs"></span>移除作业</a></li>
          {% else %}
            <li><a href="{{ path('course_manage_lesson_homework_create', {courseId:course.id, lessonId:lesson.id,homeworkId:homeworkId}) }}" ><span class="glyphicon glyphicon-list-alt prs"></span>布置作业</a></li>
          {% endif %}
            <li class="divider"></li>
          {% set lessonId = lesson.id %}
          {% set exercise = exercises[lessonId]|default(null) %}
          {% if exercise %}
            <li><a href="javascript:;" class="delete-exercise-btn" data-url="{{ path('course_exercise_delete', {courseId:course.id, lessonId:lesson.id, id:exercise.id }) }}" ><span class="glyphicon glyphicon-trash prs"></span>移除练习</a></li>
          {% else %}
            <li><a href="{{ path('course_exercise_create', {courseId:course.id, lessonId:lesson.id}) }}" ><span class="glyphicon glyphicon-list-alt prs"></span>新增练习</a></li>
          {% endif %}
          <li class="divider"></li>
        {% endif %}

        {% if lesson.type != 'testpaper' %}
          <li><a href="javascript:;" data-toggle="modal"  data-target="#modal" data-url="{{ path('course_manage_material', {courseId:course.id, lessonId:lesson.id}) }}"><span class="glyphicon glyphicon-paperclip prs"></span>添加资料</a></li>
          <li class="divider"></li>
        {% endif %}
        
        <li class="{% if lesson.status == 'published' %}hidden {% endif %}">
          <a href="javascript:;" class="publish-lesson-btn" data-url="{{ path('course_manage_lesson_publish', {courseId:course.id, lessonId:lesson.id}) }}">
            <span class="glyphicon glyphicon-ok-circle prs"></span>发布
          </a>
        </li>

        <li class="{% if lesson.status == 'unpublished' %}hidden {% endif %}">
          <a href="javascript:;" class="unpublish-lesson-btn" data-url="{{ path('course_manage_lesson_unpublish', {courseId:course.id, lessonId:lesson.id}) }}">
            <span class="glyphicon glyphicon-remove-circle prs"></span>取消发布
          </a>
        </li>
        <li class="{% if lesson.status == 'published' %}hidden {% endif %}">
          <a href="javascript:;" class="delete-lesson-btn" data-url="{{ path('course_manage_lesson_delete', {courseId:course.id, lessonId:lesson.id}) }}">
            <span class="glyphicon glyphicon-trash prs"></span>删除
          </a>
        </li>
        <li >
          <a href="{{ path('course_manage_lesson_code_download', {courseId:course.id, lessonId:lesson.id}) }}"target="_blank">
            <span class="glyphicon glyphicon-paperclip prs"></span>查看课时二维码
          </a>
        </li>
        <li >
          <a href="{{ path('course_manage_lesson_code_edit', {courseId:course.id, lessonId:lesson.id}) }}"target="_blank">
            <span class="glyphicon glyphicon-paperclip prs"></span>修改二维码信息
          </a>
        </li>
      </ul>
    </span>
  </div>
</li>